#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
class Solution
{
public:
    enum COLOR
    {
        RED,
        WHITE,
        BLUE
    };
    void sortColors(vector<int> &nums)
    {
        int pivot = WHITE;
        int i = -1;
        for (int j = 0; j < nums.size(); ++j)
        {
            if (nums[j] < pivot)
                swap(nums[++i], nums[j]);
        }
        i = nums.size();
        for (int j = nums.size() - 1; j >= 0; --j)
        {
            if (nums[j] > pivot)
                swap(nums[--i], nums[j]);
        }
    }
};